Search engine for large database search using hash pointers

ABSTRACT

A search engine ( 100 ) having a controller ( 112 ), a memory ( 114 ), and a hash pointer unit ( 110 ). The memory ( 114 ) includes a database of search data and associate content, and the controller ( 112 ) uses individual search values to access the memory ( 114 ) to obtain individual search results. The controller ( 112 ) includes a hash function ( 116 ) that generates a hash value from a, typically large, search value into a, typically smaller, hash value that may be a hash collision. The controller ( 112 ) converts the hash value into a hash address which is communicated to the hash pointer unit ( 110 ), which receives the hash address and provides a hash pointer that is communicated to and used by the memory to look up respective search results. In this manner hash collisions are avoided and the size of the memory ( 114 ) is not a function of the degree of multi-way set-associativity used.

CROSS REFERENCE TO RELATED APPLICATIONS

[0001] This is a continuation of application Ser. No. 09/927,599, filedAug. 9, 2001.

BACKGROUND OF INVENTION

[0002] 1. Technical Field

[0003] The present invention relates generally to static informationstorage and retrieval systems, and more particularly to architecturesfor searching large databases of stored data using hash algorithms.

[0004] 2. Background Art

[0005] Many real world systems require searching information at veryhigh speed; hence hardware based approaches are often employed. Anincreasingly common example, and the one which will primarily be usedherein, is searching in network systems. In information searching thereare basically two types of information searching: exact match andpartial match searching. The present invention is intended to solveproblems in exact match searching. Two approaches widely used today forexact match searching are hash-based searching and content addressablememory or CAM-based searching.

[0006] To compare these two types, for instance, one can consider theproblem of designing and searching a database that can support onemillion entries of 128-bit input data and 32-bit of associated data.

[0007] In a hash based search, the concept is to map the search data,which is often very lengthy as in this 128-bit example, to numbers whichare often much smaller, say only 20-bits in length, since only 20 bitsare needed to address one million entries. Since this conversion(128-bit to 20-bit) is not a one-to-one mapping, collisions will verylikely occur. That is, a hash collision is said to have occurred herewhen the hash function employed returns the same 20-bit result for twodifferent 128-bit inputs.

[0008] Furthermore, depending on the particular data encountered and theparticular hash function employed, more than just two different 128-bitinputs can be mapped to the same 20-bit result number. It therefore isnot uncommon for a system to have to be designed to accommodate the factthat three, four or even more different inputs will be mapped by thehash function to the very same output number. There are many differentapproaches to reducing the impact of hash collisions. One approach is toincrease the database size. For instance, consider first the degeneratecase, a “1-way-set-associative hash.” Here the 128-bit input searchvalues are mapped to 20-bit values used as address indexes into amemory. The memory needs to be 1M in size, since each 20-bit value needsto map to an actual memory location. This case, of course, does nothandle any hash collisions at all. It simply ignores them, and thereforeis not very practical. Consider next a “2-way-set-associative hash.”Here one set of collisions can be handled. The memory needs to be 2M insize, since each 20-bit value needs to map to two actual memorylocations. Higher-way associative hashes can also be used, but beyond a“4-way-set-associative hash” this approach of simply increasing thedatabase size is typically not practical. Based on the parameters usedhere, in a 4-way case the memory would need to be 4M in size and wouldbe very poorly utilized.

[0009]FIG. 1 (background art) is a block diagram depicting a searchengine 10 using conventional hash-based database searching. A controller12 includes a hash function 14 which can receive 128-bit input searchvalues and generate 20-bit hash value which is used as an index toaddress a memory 16.

[0010] If we assume that hash collisions will not happen too often, anduse only a 2-way-set-associative hash, the memory 16 needs to be able tostore a database having two million entries. This is depicted here as abase region 16 a and a conflicts region 16 b in the memory 16, a totalof two regions for a 2-way-set-associative hash. A 21-bit wide addressbus 18 is therefore needed to communicate between the controller 12 andthe memory 16 (20-bits to address the first one million entries in thebase region 16 a, and one additional bit to address the second millionentries, in the conflicts region 16 b used to support the one set ofpotential collision cases). The entries in the memory 16 each require160 bits, 32 bits for an associate value which is the desired result ofthe search and 128 bits for the input search value which is intended toproduce that particular result.

[0011] The above illustrates a key point in hash-based databasesearching—both the associate content value and a stored instance of thesearch value which produces it must be stored in the memory 16 andreturned to the controller 12, here via a 160-bit result bus 20, for thecontroller 12 to perform a comparison to determine if a hash collisionhas occurred. The controller 12 can only do this if it has both theinput and stored search values. If these are the same in a search resultobtained from the base region 16 a, the associate value in the searchresult is valid and the controller 12 can carry on with using it. Ifthese values are different, however, a hash collision has occurred. Thenthe controller 12 accesses the memory 16 a second time, using the 21^(st) bit to address an entry stored in the conflicts region 16 b. Ifthe input and stored search values are now the same, the controller 12can again carry on. If these are still different, however, another hashcollision has occurred and using only a 2-way-set-associative hash and atwo million entry database is not adequate for the task at hand.

[0012] A good hash algorithm is one that produces very few collisions.However, it usually cannot be known how many collisions will actuallyoccur, because the pattern of the input search data is typically notknown in advance. If there is more than one collision for a givennumber, a 2-way-set-associative hash will not be able to handle it. Inorder to support the database with more confidence, 4-way or moreset-associative approach should then be used. When such is used, morememory must be provided.

[0013] The size of the memory depends on two things: the number ofentries being supported and the number of ways of set-associativityemployed. For example, to support n entries using4-way-set-associativity, the memory size has to have 4 n entries. Forone million entries this means that the memory must be four millionentries “deep,” even though only one million of entries will everpotentially be used, i.e., less than 25% of the memory is utilized.

[0014] The number of ways of set-associativity also dictates that moreclock cycles will potentially be needed for a search. As noted for the2-way associative hash in FIG. 1, it will take a maximum of two memoryread operations (instead of one) to perform a database search, since onecollision may happen during the search. Similarly, for an m-wayset-associativity it may take up to m memory read operations to performa database search.

[0015] It follows that hash-based database searching has substantialdisadvantages when one considers the large amount of memory needed andthe limited speed of searching possible. For discussion, these can betermed the memory size issue and the search speed issue, and bothincrease linearly when hash-based searching is used. The memory sizeissue is largely a matter of cost, and thus may be easily solved if costis not a serious problem. The search speed issue is more difficult,however, and it may make hash-based searching impractical in manyapplications.

[0016]FIG. 2 (background art) is a basic block diagram depicting asearch engine 50 using conventional CAM-based database searching. Here acontroller 52 provides a 128-bit input search value to a CAM 54 thatwill search its own database (of one million entries) and provide a20-bit index value to a memory 56, where up to one million 32-bitassociate content values may be stored.

[0017] Although other types of memory can theoretically be used in placeof the CAM 54, content addressable memory, or associative memory as itis also widely known, is particularly useful. When provided an inputsearch value, a content addressable memory will very rapidly provide asits output the address within it of any match (multiple matches shouldnot occur here unless the CAM 54 is improperly programmed). This index,perhaps with appropriate translation by a suitable logic circuit, canthen be used as an address into the memory 56.

[0018] The controller 52 here provides the input search value to the CAM54 via a 128-bit wide search data bus 58; the CAM 54 provides theaddress index value to the memory 56 via a 20-bit wide address bus 60,and the memory 56 provides the search result to the controller 52 via a32-bit wide result bus 62. Since the CAM 54 always provides, ifanything, a unique address in the memory 56, only one read operation isrequired.

[0019] TABLE 1 summarizes, along with aspects of the present inventionwhich are discussed presently, the differences between the prior arthash-based and CAM-based approaches when the controllers 12, 52 are ASICdevices and the memories 16, 56 are RAM. From this a number ofrespective advantages and disadvantages for these approaches becomereadily apparent. For instance, the hash-based approach has lower costand power consumption. The CAM-based approach provides a lower pin countat the ASIC (which is highly desirable), uses less memory (overall),never encounters collisions (no dependency is necessary on the nature ofthe input data values or on the choice of an algorithm), and has apotentially higher search speed (one which is consistent and known).There are still other advantages and disadvantages, but these are thetypical major ones.

[0020] Accordingly, it is desirable to find hardware-based approaches ofdatabase searching which do not suffer from the respective disadvantagesof the conventional hash-based and CAM-based approaches, and whichretain or provide additional advantages for these prior art approaches.

SUMMARY OF INVENTION

[0021] Accordingly, it is an object of the present invention to providemore efficient database search engines.

[0022] And another object of the invention is to provide database searchengines which employ hash-based techniques yet are less restricted byhash collisions.

[0023] Briefly, one preferred embodiment of the present invention is adatabase search engine including a controller having a hash functionable to receive an input search value and create hash addresses whichare smaller than the input search value. A hash pointer unit storespointer values, which are addressed based on the hash addresses. Amemory stores a database of search results, wherein the respectivesearch results are addressed based on said pointer values. An addressbus connects the controller to the hash pointer unit and communicatesthe hash addresses from the controller to the hash pointer unit. Apointer bus connects the hash pointer unit to the memory andcommunicates the pointer value from the hash pointer unit to the memory.Finally, a result bus connects the memory to the controller andcommunicates the search results from the memory to the controller.

[0024] An advantage of the present invention is that it provides adirect and very substantial cost savings over hash-based prior artapproaches due to improved memory utilization.

[0025] And another advantage of the invention is that it is easilyimplemented within many existing search engine schemes, thus permittingrapid adoption and minimal industry change.

[0026] These and other objects and advantages of the present inventionwill become clear to those skilled in the art in view of the descriptionof the best presently known mode of carrying out the invention and theindustrial applicability of the preferred embodiment as described hereinand as illustrated in the several figures of the drawings.

BRIEF DESCRIPTION OF DRAWINGS

[0027] The purposes and advantages of the present invention will beapparent from the following detailed description in conjunction with theappended tables and figures of drawings in which:

[0028] TABLE 1 summarizes differences between the prior art hash-basedand CAM-based approaches and a variation of the embodiment of thepresent invention depicted in FIG. 8;

[0029] TABLE 2 summarizes inputs and stored values in an exampledescribed for the embodiment of the present invention depicted in FIG. 6and the process for that embodiment depicted in FIG. 7; and

[0030] TABLE 3 provides a comparison of two different implementations ofa one million entry 8-way-set-assoicative hash-based system, wherein oneuses a typical prior art hash-based approach and the other uses theH-CAM with the indirect hash pointer and a cascading mechanism of thepresent invention.

[0031]FIG. 1 (background art) is a block diagram depicting a simplehash-based database searching example;

[0032]FIG. 2 (background art) is a block diagram depicting a simpleCAM-based database searching example;

[0033]FIG. 3 is a block diagram depicting a search engine according to ahash pointer based embodiment of the present invention;

[0034]FIG. 4 is a block diagram depicting a search engine according to asingle-level hash-CAM based embodiment according to the invention;

[0035]FIG. 5 is a block diagram depicting a search engine according to aquad-level hash-CAM based embodiment of the invention;

[0036]FIG. 6 is a block diagram depicting a search engine used in anexample of a multi-leveled architecture embodiment of the invention,simplified for use in a detailed example;

[0037]FIG. 7 is a flow chart depicting a process suitable for use withthe H-CAM element of the embodiment of the invention shown in FIG. 6.;

[0038]FIG. 8 is a block diagram depicting a search engine according toan alternate embodiment of the invention, including a H-CAM elementhaving a comparison section;

[0039]FIGS. 9a-b show possible sub-architectures for parts of the H-CAMelement of the embodiment shown in FIG. 8, wherein FIG. 9a is a blockdiagram depicting an architecture for first a logic unit and FIG. 9b isa block diagram depicting an architecture for a search data storage;

[0040]FIG. 10 is a block diagram depicting a search engine according toan alternate embodiment of the invention, including a H-RAM element;

[0041]FIGS. 11a-b show possible sub-architectures for parts of the H-RAMelement of the embodiment shown in FIG. 10, wherein FIG. 11a is a blockdiagram depicting an architecture for a first logic unit and FIG. 11b isa block diagram depicting an architecture for a search data storage;

[0042]FIG. 12 is a block diagram depicting a search engine incorporatingmany of the principals discussed for other embodiments;

[0043]FIG. 13 is a block diagram depicting a search engine having theability to scale for use in large systems by cascading multiple H-CAMelements;.

[0044]FIG. 14 is a block diagram depicting a search engine having theability to scale for use in large systems by cascading multiple H-RAMelements; and

[0045]FIG. 15 is a block diagram depicting a search engine having theability to scale for use in large systems by cascading multiple CAM,H-CAM and H-RAM elements.

DETAILED DESCRIPTION

[0046] A preferred embodiment of the present invention is a system forlarge database searches which marries both hash-based and CAM-basedadvantages without the respective disadvantages. As illustrated in thevarious drawings herein, and particularly in the views of FIGS. 3-6, 8,10, and 12-15, preferred embodiments of the invention are depicted bythe general reference characters 100, 200, 300, 400, 500, 600, 700, 800,900, 1000, and 1100.

[0047] A Search Engine Using a Hash Pointer:

[0048]FIG. 3 is a block diagram depicting a search engine 100 accordingto one preferred embodiment of the present invention. The particularlynovel aspect in this embodiment is the use of a hash pointer unit 110,which is interposed between a controller 112 and a memory 114. For anexample here, lets say that the controller 112 uses 128-bit wide inputsearch values to search a database of up to one million entries of32-bit associate content value stored in the memory 114. The controller112 includes a hash function 116 that generates hash addresses (whichpotentially may be hash collisions). The controller 112 may besubstantially the same as the conventional controller 12 discussed withFIG. 1 (background art). Unlike the scheme used in FIG. 1, however, letsuse 4-way set-associativity here. Accordingly, using four way access toup to one million addresses, a 22-bit address bus 118 is needed toconnect the controller 112 to the hash pointer unit 110.

[0049] The hash pointer unit 110 includes a 4M×20 memory which maycontain programmable unique “pointers” to the one million potentialentries in the memory 114. The hash pointer unit 110 is 4M deep tohandle 4-way associativity to one million potential entries, but it needbe only 20-bits wide to provide pointers able to access the actual onemillion potential entries in the memory 114. A 20-bit wide pointer bus120 can therefore be used to connect the hash pointer unit 110 to thememory 114.

[0050] Since hash collisions are possible and must still be checked for,the memory 114 accordingly needs to include entries 160-bits wide(128+32). Individual such entries, or search results are then providedto the controller 112 via a 160-bit wide result bus 122.

[0051] The operation here is similar to that of the prior art searchengine 10 in FIG. 1, except that the stored search values and associatecontent values are accessed “indirectly” through the pointer valuesstored in the hash pointer unit 110. A 128-bit input search value isused by the hash function 116 to generate a 20-bit hash output, whichthe controller 112 combines with an offset value to create a 22-bit hashaddress.

[0052] Any of many different schemes will work to convert the hash valueto the hash address. For instance, the controller 112 may do this byprefixing a 2-bit offset value to the hash value. Thus, a “00” prefixcan represent that the hash output maps to the first “way” in the 4-wayset-association used here, a “01” can represent the second way, and sofourth. On a first try with a particular 128-bit input search value,“00” may be prefixed to the hash value. If the search result thisproduces has a stored search value that matches the original inputsearch value, there has been no hash collision. In contrast, if thesevalues do not match, a hash collision has occurred. Then “01” may beprefixed to the (same) hash value, creating a new hash address, and thehash pointer produced by the hash pointer unit 110 in response to thismay similarly be used to retrieve a different search result. This cancontinue, handling up to four 128-bit input search values that the hashfunction maps to the same hash value in this embodiment.

[0053] Summarizing, the search speed issue (as termed in the BackgroundArt section) is not changed. However, the memory size issue is greatlychanged. Whereas a 4M×160 memory would be required using a prior art4-way set-associative hash-based approach, the inventive search engine100 here requires only a 1M×160 memory and a 4M×20 memory—a substantialoverall savings.

[0054] A Single Level H-Cam and a Search Engine Employing It:

[0055]FIG. 4 is a block diagram depicting a search engine 200 accordingto another preferred embodiment of the present invention. Theparticularly novel aspect of this embodiment is a single level H-CAM210. The single level nature of the H-CAM 210 should not be confusedwith the set-associative nature of a hash approach. That is, the “level”and “way” are different concepts. The H-CAM 210 in the example here is1-way-set-associative, but that is coincidental with the use here ofonly a single level.

[0056] The search engine 200 further includes a controller 212 and amemory 214, which both may be substantially conventional. For instance,the controller 212 may be an application specific integrated circuit(ASIC) and the memory 214 may be an external random access memory (RAM).

[0057] The controller 212 communicates an input search value to theH-CAM 210, via a search data bus 216, and the H-CAM 210 thencommunicates an address value to the memory 214, via an address bus 218.Responsive to the address value, a result value is communicated backfrom the memory 214 to the controller 212, via a result bus 220.

[0058] As shown, the architecture of the H-CAM 210 includes a hash unit222, a CAM unit 224, and a logic unit 226. The input search value isprovided, via a first path 228 a, to both the hash unit 222 and the CAMunit 224. The hash unit 222 then provides a hash output on a second path228 b, and the CAM unit 224 may (if it finds a match) provide a CAMoutput on a third path 228 c (the address within it of such a match).The logic unit 226 receives the CAM and hash outputs, via the paths 228b-c, and selects one for use as the address value, which it thenprovides to the memory 214 via the address bus 218 (effectively a lastpath 228 d).

[0059] The following is an example pertaining particularly to the searchengine 200 depicted in FIG. 4. Lets assume here that the search engine200 will also use 128-bit wide input search values, to search a databaseof up to one million entries of 32-bit associate values. The search databus 216 is 128 bits wide, the address bus 218 is 21 bits wide, and theresult bus 220 is 160 bits wide.

[0060] The hash unit 222 employs a hash algorithm to map each 128-bitwide input search value to a “narrow” 20-bit wide hash output value.Each input search value received by the hash unit 222 causes it toprovide a respective hash output to the logic unit 226. Of course, thehash output will depend on the hash algorithm actually used.

[0061] The CAM unit 224 in this example is a 100K×128 contentaddressable memory. If an input search value is received in the CAM unit224 that matches a stored comparison value (a 128-bit wide copy of aprevious search value that caused a hash collision), the address of thatmatch is provided by the CAM unit 224, as a CAM output, to the logicunit 226. In contrast, however, if an input search value is receivedwhich does not match any comparison value, no CAM output is provided.

[0062] The logic unit 226 here operates in a straight forward manner. ACAM output has higher priority than a hash output. If the logic unit 226receives only a hash output, that becomes the basis of the addressvalue. If it receives both a hash output and a CAM output, the CAMoutput becomes the basis of the address value. This is so because thepresence of a CAM output indicates that there is an already known andcataloged hash collision case. Using the hash output for the addressvalue here would cause that collision to occur. Alternately, using theCAM output for the address value instead will avoid that collision. Ifthe logic unit 226 receives only a CAM output it can go ahead and usethat as the basis for the address value. However, it may be desirable totreat this as an error condition in many embodiments, since a properhash algorithm should always produce a hash output.

[0063] If necessary, the logic unit 226 also translates the hash or CAMoutput into an address value that appropriately maps to the memory 214.For instance, the hash output may (naturally or by translation) map tothe low-order one million addresses in the memory 214. If the CAM outputalso maps to the low-order one-hundred thousand addresses in the memory,it needs to be translated to instead map to high-order addresses in thememory 214.

[0064] The memory 214 here includes a base region 214 a for storingsearch results that are accessed based on the hash outputs, and aconflicts region 214 b for storing search results that are accessedbased on the CAM outputs. The search results in the base region 214 aneed to include a 128-bit wide stored search value and a 32-bitassociate value, for reasons discussed presently. It then follows,because every possible hash output (defined by a 20-bit index value)must map to a search result, that the base region 214 a in the examplehere needs to have a size of at least 1M×160.

[0065] The search results stored in the conflicts region 214 b of thememory 214, however, do not have to include any stored search values.The CAM unit 224 already includes full 128-bit wide copies of these samesearch values it uses to index into the conflicts region 214 b, andstoring any stored search values in the conflicts region 214 b isunnecessary and wasteful. The conflicts region 214 b here can thereforesimply contain the 32-bit associate values, and thus need only be100K×32 in size.

[0066] The address bus 218, memory 214, and result bus 220 arestylistically shown in FIG. 4 in a manner to emphasize that the baseregion 214 a and the conflicts region 214 b may be different in size,and that they may even be distinct physical devices. The result bus 220needs to be 160 bits wide to carry either size of result value, but a128-bit field can be empty whenever a result value is taken from theconflicts region 214 b.

[0067] The controller 212 receives a result value from the memory 214,and it may check for a new hash collision. The controller 212 can easilydetermine if the result value includes a stored search value. If not,the result value will have come from the conflicts region 214 b and the32-bit associate value in the present result value can be used withconfidence that it is uniquely associated with the original input searchvalue. In contrast, for a non-empty stored search value, the resultvalue will have come from the base region 214 a in the memory 214 and ahash collision is still a possibility that needs to be dealt with. Thecontroller 212 can then compare the nonempty stored search value withthe original input search value. If these are the same, no hashcollision has occurred and the search engine 200 can simply carry on anduse the 32-bit associate value in the present result value withconfidence. However, if these values differ, a new hash collision hasoccurred and the associate value received as part of the result valueshould not be used. When a new hash collision is detected in this mannerthe search engine 200 specifically the CAM unit 224 and the conflictsregion 214 b of the memory 214, may be programmed to avoid it in thefuture. Theoretically, the search engine 200 here can handle hashcollisions up to 100,001 deep in a worst case situation, since theconflicts region 214 b has 100K locations to map collisions to after afirst entry in the base region 214 a has been used.

[0068] A Multi-Level H-CAM and a Search Engine Employing It:

[0069]FIG. 5 is a block diagram depicting a search engine 300 accordingto another preferred embodiment of the present invention. Theparticularly novel aspect in this embodiment is a quad-level H-CAM 310.A controller 312 and a memory 314 are also provided.

[0070] In a manner much similar to the previous embodiment, thecontroller 312 here communicates an input search value to the H-CAM 310,via a search data bus 316, and the H-CAM 310 then communicates anaddress value to the memory 314, via an address bus 318. Responsive tothe address value, a search result is then communicated back from thememory 314 to the controller 312 via a result bus 320.

[0071] As shown, the architecture of the H-CAM 310 includes a number ofpaired hash units (hash units 322 a-d) and CAM units (CAM units 324a-d), and a single logic unit 326. The input search value is provided tothe hash unit 322 a and its paired CAM unit 324 a, via a path 328 a. Thehash unit 322 a then provides a first hash output on a path 328 b, whichconveys it to the next hash unit 322 a where a second hash output isprovided on a path 328 c, and so forth until a last, fourth hash outputis provided on a path 328 e. Concurrently, the CAM unit 324 a provides afirst CAM output on a path 328 i, a second CAM output is provided on apath 328 h, and so forth until a last, fourth CAM output is provided ona path 328 f. Summarizing, at this point there is a single final hashoutput on a path 328 e and multiple CAM outputs on paths 328 f-i, andall of these paths 328 e-i lead to the logic unit 326. The logic unit326 selects a value from those it receives to use as the address value,and provides it to the memory 314 via the address bus 318.

[0072] The following is an example particularly pertaining to the searchengine 300 depicted in FIG. 5. Inside the H-CAM 310, the path 328 a is128 bits wide, as it is essentially the same as the search data bus 316;the path 328 b is desirably smaller, say, 64 bits wide; the path 328 cis desirably still smaller, say, 48 bits wide; the path 328 d isdesirably yet smaller, say, 32 bits wide; and the paths 328 e-i are allsmaller, specifically all 20 bits wide, as one of their contents isultimately sent via the 21-bit wide address bus 318 (effectively a lastpath 328 j).

[0073] The purpose of the multiple hash units 322 a-d here is to reducethe input data space, hence the hash outputs should each desirably besmaller than the prior input. The multiple CAM units 324 a-d storeentries known to cause hash collisions at the respectively paired hashunits 322 a-d. The underlying rationale of this multi-level architectureis that when a given number of hash collisions are expected acorresponding number of CAM entries will be needed. So, based onprobability and knowing that the width of the CAMs shrink at successivelevels, using multiple levels of CAM in this manner should reduce thetotal amount of CAM require to provide for the expected number of hashcollisions. Nevertheless, the actual number of hash collisions stilldepends on the particular pattern of input data encountered.

[0074] The logic unit 326 outputs an address value based on a highestpriority scheme. The earlier CAM stages have higher priority over laterstages, and ultimately over the hash output. For example, the CAM outputof the first CAM unit 324 a has higher priority than the CAM output ofthe second CAM unit 324 b, and so forth, ending here with the CAM outputof the fourth CAM unit 324 d having priority over the hash output of thefourth hash unit 322 d. The logic unit 326 may also, if necessary,translate the outputs to an address value that appropriately maps to thememory 314.

[0075] The memory 314 has a base region 314 a, a first conflicts region314 b, a second conflicts region 314 c, a third conflicts region 314 d,and a fourth conflicts region 314 e. As was discussed for the “highest”conflicts region 214 b in FIG. 4, the fourth conflicts region 314 e doesnot need to include room for stored search values, since the first CAMunit 324 a contains a copy of the search value and will always matchuniquely.

[0076] The hash output of the fourth hash unit 322 d becomes the basisfor address values that map to the base region 314 a; the CAM output ofthe fourth CAM unit 324 d becomes the basis for address index valuesthat map to the first conflicts region 314 b; the CAM output of thethird CAM unit 324 c becomes the basis for address index values that mapto the second conflicts region 314 c; and so forth. The conflictsregions 314 b-e thus each store data to handle correspondingly higherlevel collision cases.

[0077] A Different Multi-Level H-CAM and Search Engine Employing It, ina Detailed Example:

[0078]FIG. 6 is a block diagram depicting a search engine 400 accordingto the present invention, now used in detailed example. A two-levelH-CAM 410 is provided, along with a controller 412, memory 414, searchdata bus 416, address bus 418, and result bus 420.

[0079] A programming unit 430 is also shown here (and many embodimentsof the invention will include programming capability, but is notdescribed in particular detail since its task can be performed invarious ways and using various architectures that are all substantiallyconventional or which should be readily apparent to those skilled in theart in view of the following discussion. The result bus 420 also differsfrom the result bus 220 (FIG. 4) in that it is bi-directional, and thememory 414 here accordingly accommodates that. Some variations of theprogramming unit 430 may employ these when programming the memory 414.

[0080] As shown, the architecture of the H-CAM 410 here includes a twohash units (hash units 422 a-b) and two CAM units (CAM units 424 a-b),and a logic unit 426. A path 428 a connects the search data bus 416 tothe first hash unit 422 a and the first CAM unit 424 a; a path 428 bconnects the first hash unit 422 a to the second hash unit 422 b and thesecond CAM unit 424 b; a path 428 c connects the second hash unit 422 bto the logic unit 426; a path 428 d connects the second CAM unit 424 bto the logic unit 426; and a path 428 e connects the first CAM unit 424a to the logic unit 426.

[0081] The memory 414 includes a base region 414 a, a first conflictsregion 414 b, and a second conflicts region 414 c. These might, forinstance, respectively be 1M×160, 200K×160, and 100K×32 in size.

[0082]FIG. 7 is a flow chart depicting a process 500 suitable for usewith the H-CAM 410 of FIG. 6. The process 500 starts with a step 510,where the two CAM units 424 a-b and the memory 414 are empty. In a step512 an input search value is provided by the controller 412 to the H-CAM410. In a step 514 the input search value is received by and processedby the first hash unit 422 a to generate a first hash output. In a step516, the input search value is also received by and processed by thefirst CAM unit 424 a to create a first CAM output (but only if there isa match). In a step 518 the first hash output is received by andprocessed by the second hash unit 422 b to generate a second hashoutput. In a step 520, the first hash output is also received by andprocessed by the second CAM unit 424 b to create a second CAM output(but, again, only if there is a match).

[0083] Summarizing, up to here the H-CAM 410 has internally produced afinal (second) hash output, and possibly also either or both of firstand second CAM outputs. Next, in a step 522 these outputs are receivedby and prioritized by the logic unit 426. The first CAM output receivesthe highest priority; if it is present it is used for the address value.The second CAM output receives the next priority; if it is present andthe first CAM output is not, the second CAM output is used for theaddress value. The (final) second hash output receives the lowestpriority; if it is present and the neither of the CAM outputs is, thesecond hash output is used for the address value. If necessary, thelogic unit 426 also translates the respective output used so that theaddress value maps to a corresponding area in the memory 414.

[0084] In a step 524 it is determined whether a hit was detected in thefirst CAM unit 424 a. If so, in a step 526 the first CAM output is usedto access the memory 414 and the controller 412 will receive a searchresult (typically only an associate value) stored in the secondconflicts region 414 c. Since the contents of the second conflictsregion 414 c are always uniquely associated with possible input searchvalues, the process 500 is essentially finished for the present inputsearch value, and the search engine 400 can carry on with whateverfurther operations on the search result are desired.

[0085] If a hit was not detected in the first CAM unit 424 a, in a step528 it is determined whether a hit was detected in the second CAM unit424 b. If so, in a step 530 the first CAM output is used to access thememory 414 and the controller 412 receives a search result stored in thefirst conflicts region 414 b.

[0086] There still remains a possibility, however, that the first hashoutput, upon which the second CAM output is based, is a new hashcollision. Therefore, in a step 532 it is determined whether the storedsearch value in the returned search result is the same as the originalinput search value. If so, in a step 534 the process 500 is essentiallyfinished for the present input search value, and the search engine 400can carry on with whatever further operations on the search result aredesired.

[0087] If the stored search value in the returned search result is notthe same as the original input search value, in a step 536 the first CAMunit 424 a can be programmed with the input search value and the secondconflicts region 414 c can be programmed with an associate value forthis (all under direction of the programming unit 430). The process 500is essentially finished for the present input search value.

[0088] If there were no CAM outputs (steps 524, 528), in a step 538 thesecond hash output is used to access the memory 414 and the controller412 will receive a search result stored in the base region 414 a.

[0089] In a step 540 the search result is examined to see if it containsany value. If so, there again still remains a possibility that thesecond hash output is a new hash collision, and in a step 542 thereturned search result is compared with the original input search value.

[0090] In a step 544 it is determined whether these values are the same.If this is also so, in a step 546 the process 500 is essentiallyfinished for the present input search value, and the search engine 400can carry on with whatever further operations on the search result aredesired.

[0091] In contrast, if the compared values are different, in a step 548the second CAM unit 424 b can be programmed with the first hash outputand the first conflicts region 414 b can be programmed with a searchresult (stored search value and associate value, all under direction ofthe programming unit 430). The process 500 is then essentially finishedfor the present input search value.

[0092] Lastly, if in step 540 it is determined that the search result isempty, in a step 550 a search result based on the input search value andan associate value for it may be programmed into the base region 414 aof the memory 414, under direction of the programming unit 430. Theprocess 500 is then essentially finished for the present input searchvalue.

[0093] With reference now to FIGS. 6-7 and TABLE 2, an example ispresented. By definition here the input search values are six-digitslong and the associate values are two-digits long (base 10 numbers arealso used here to facilitate understanding). The search data bus 416 andthe path 428 a are six-digit buses, the path 428 b is a four-digit bus,and the paths 428 c-e are all two-digit buses. The address bus 418 is athree-digit bus because it must carry the two-digit content of thesecond hash output when there are no hash collisions in the H-CAM 410,and also carry three digits otherwise (discussed presently).

[0094] Accordingly, the format 000:000000,00 can be used to referencethe memory 414, wherein the three digits to the left of the colonrepresent an address index value, the six digits between the colon andcomma represent a stored search value, and the two digits to the rightof the comma represent an associate value.

[0095] The contents of the first CAM unit 424 a can be represented usingthe format 000:000000, wherein the three digits to the left of the colonrepresent an address index value and the six digits to the right of thecolon represent a comparison value equaling an input search value knownto produce a collision in the first hash unit 422 a. That is, the6-digit comparison value is what is compared for a match and the 3-digitaddress value is associatively “stored” with it (typically in CAM, wherethis address is simply based on the storage location of the comparisonvalue), to be used to avoid the hash collision by accessing an alternatelocation in the memory 414 (i.e., in the second conflicts region 414 c).

[0096] The contents of the second CAM unit 424 b can be representedusing the format 000:0000, wherein the three digits to the left of thecolon represent an address value and the four digits to the right of thecolon represent a comparison value for a hash output known to produce acollision in the second hash unit 422 b. That is, the 4-digit comparisonvalue is what is compared for a match here and the 3-digit address valueis associatively stored with it, to be used to avoid the hash collisionhere by accessing an alternate location in the memory 414 (i.e., in thefirst conflicts region 414 b).

[0097] Initially (step 510), the CAM units 424 a-b and the memory 414have nothing stored in them. Typically all the values will be zero, butother conventions can be used. This state is represented in row 1 ofTABLE 2.

[0098] A first search value is then entered, say, 324238 (step 512). Thefirst hash unit 422 a generates a first hash output, say, 7783 (step514). With nothing stored yet in the first CAM unit 424 a, it will notprovide any first CAM output (step 516). The second hash unit 422 b willgenerate a second hash result, say, 63 (step 518). With nothing storedyet in the second CAM unit 424 b, it will not provide any second CAMoutput (step 520). The logic unit 426 therefore simply picks the secondhash output, 63 (step 522). Using this address value, the memory 414provides the content of address 63, which is nothing so far (step 538).This state is represented in row 2 of TABLE 2.

[0099] The controller 412 will determine that the first search value(324238) has no entry yet in the memory 414 (step 540). One is thereforecreated in the base region 414 a using the search value and an associatevalue for it, say, 17. This entry is programmed into the memory 414 ataddress 63 (step 550), since that is what the hash units 422 a-b heremap the search value of 324238 to, and address 63 is presentlyavailable. This state is represented in row 3 of TABLE 2.

[0100] A second search value is entered, say, 578901. The first hashunit 422 a will generate a first hash result, say, 6311. The second hashunit 422 b will generate a second hash result, say, 63 again. Withnothing stored yet in the CAM units 424 a-b, they do not create any CAMoutputs, and the logic unit 426 picks the second hash output, 63. Usingthis address value, the memory 414 provides the content of address 63,which is 324238, 17. This state is represented in row 4 of TABLE 2.

[0101] The controller 212 now determines that: the search value (578901)has a corresponding entry in the memory 414; a hash collision hasoccurred because the search field in the search result is different thanthe input search value used (324238 ≠578901)(step 542); and that this isa first level hash collision. An entry in the second CAM unit 424 b istherefore created (step 548) using the first hash output (6311) and anavailable address for an entry in a conflicts region (here the firstconflicts region 414 b) of the memory 414, say, address 200.Furthermore, a new entry is also created in the memory 414, at address100 in the first conflicts region 414 b based on the search value(578901) and an associate value provided for it, say, 23. This state isrepresented in row 5 of TABLE 2.

[0102] A third search value is entered, say, 322413. The first hash unit422 a will generate a first hash output, say, 6311 again, which forcesthe second hash unit 422 b to generate 63 as the second hash output. Thefirst CAM unit 424 a has no match for 322413, so there is no first CAMoutput. However, the second CAM unit 424 b has a match for 6311, so itprovides the associatively stored address index 100 as the second CAMoutput (step 520). The logic unit 426 evaluates its inputs and thenpicks the second CAM output, 100. Using this as the address value, thememory 414 provides the content of address 100, which is 578901, 23.

[0103] The controller 412 now determines that: the search value (322413)has a corresponding entry in the memory 414; a hash collision hasoccurred because the search field in the search result is different thanthe input search value used (324238 ≠322413); this is not a first levelhash collision; and that this is a second level hash collision. An entryin the first CAM unit 424 a is therefore created (step 536) using thesearch value (322413) and an available address for an entry in theconflicts region (here the second conflicts region 414 c) of the memory414, say, address 200. Furthermore, a new entry is also created in thememory 414, at address 200 in the second conflicts region 314 c andbased on the search value (322413) and an associate value provided forit, say, 86. No search value is required in the second conflicts region414 c the memory 414 because the first CAM unit 424 a already containsit and it will always map uniquely (a dash represents this in TABLE 2).This state is represented in row 7 of TABLE 2.

[0104] A fourth search value is entered, say, 578901 again. The firsthash unit 422 a generates a first hash output of 6311, which forces thesecond hash unit 422 b to generate 63 as the second hash output. Thefirst CAM unit 424 a has no a match for 578901, so there is no first CAMoutput. The second CAM unit 424 b has a match for 6311, so the secondCAM output is the associatively stored address index 100. The logic unit426 evaluates its inputs and then picks the second CAM result, 100.Using this address value, the memory 414 provides the content of address100, which is 578901, 23.

[0105] The controller 412 now determines that: the search value (578901)has a corresponding entry in the memory 414; and a new hash collisionhas not occurred because the search field in the search result is thesame as the input search value used (578901=578901). No learning istherefore necessary and the contents of the associate value field, 23,can be used by the search engine 400. This state is represented in row 8of TABLE 2.

[0106] A fifth search value is entered, say, 322413 again. The firsthash unit 422 a will generate a first hash output of 6311, which forcesthe second hash unit 422 b to generate 63 as the second hash output. Thefirst CAM unit 424 a has a match for 322413, so the first CAM output isthe associatively stored address index 200. The second CAM unit 424 balso has a match for 6311, so the second CAM output is the associativelystored address index 100. The logic unit 426 evaluates its inputs andthen picks the first CAM result, 200 (since a first CAM output getshighest priority). Using this as the address value, the memory 414provides the content of address 200, which is-, 86 (recall that thereare no stored search values in the highest order conflicts region).

[0107] The controller 412 now determines that: the search value (322413)has a corresponding entry in the memory 414; and a new hash collisionhas not occurred because the search field in the result is the same asthe input search value used (322413=322413). No learning is thereforenecessary and the contents of the associate value field, 86, can be usedby the search engine 400. This state is represented in row 9 of TABLE 2.

[0108] Finally, a sixth search value is entered, say, 324238 again. Thefirst hash unit 422 a will generate a first hash output of 7783 again,which forces the second hash unit 422 b to generate 63 again as thesecond hash output. The first CAM unit 424 a has no match for 324238, sothere is no first CAM output. The second CAM unit 424 b has no match for7783, so there also is no second CAM output. The logic unit 426evaluates its inputs and then picks the second hash output, 63. Usingthis as the address value, the memory 414 provides the content ofaddress 63, which is 324238, 17.

[0109] The controller 412 now determines that: the search value (324238)has a corresponding entry in the memory 414; and a new hash collisionhas not occurred because the search field in the search result is thesame as the input search value used (324238=324238). No learning istherefore necessary and the contents of the associate value field, 17,can be used by the search engine 400. This state is represented in row10 of TABLE 2.

[0110] A H-CAM Including a Hash Pointer and a Search Engine EmployingIt:

[0111]FIG. 8 is a block diagram depicting a search engine 600 accordingto another preferred embodiment of the present invention. Theparticularly novel aspect here is a single level H-CAM 610 which employsa variation of the hash pointer (FIG. 3) to perform internal comparisonsfor detecting hash collisions. The H-CAM 610 works with a controller 612and a memory 614. These may be substantially conventional, but are bothdifferent in some regards from the controller 212 and memory 214 (FIG.4). In this embodiment the controller 612 does not need to receive anystored search values back for performing comparisons against originalinput search values (reducing its pin-count and footprint), and thememory 614 does not need to store the search values (reducing its size).

[0112] As shown in FIG. 8, the architecture of the H-CAM 610 is similarin some respects to the H-CAM 210 of FIG. 4. The H-CAM 610 includes ahash unit 622, a CAM unit 624, a first logic unit 640, and a comparisonsection 652. The salient difference is the comparison section 652, whichincludes a search data storage 654, a comparator 656, and a second logicunit 658.

[0113] With reference now also to FIGS. 9a-b, these depict possibleinternal architectures for the first logic unit 640 and the search datastorage 654. FIG. 9a is a block diagram depicting one architecture forthe first logic unit 640, wherein it receives the hash output, the CAMoutput, and also a CAM hit signal (the mere presence of a CAM outputdenotes a hit, of course, but using a separate signal provides somespeed and logic design benefits). The first logic unit 640 connects tothe search data storage 654 and provides it with a hash address based onthe hash output.

[0114]FIG. 9b is a block diagram depicting an architecture for thesearch data storage 654, wherein it is broken into two memory blocks: ahash pointer memory 660 and a search data memory 662. Conceptually thehash pointer memory 660 works much like the hash pointer unit 110discussed with reference to FIG. 3. The hash pointer memory 660 herereceives the hash address and provides a pointer value. It thus has asize based on the number of ways of set-associativity used. The pointervalue is then used as an address input to the search data memory 662,which here contains the stored search values that are used to comparewith the original input search values to detect hash collisions. Thehash pointer memory 660 typically will be much deeper (m>n in FIG. 9b)than the search data memory 662, because its purpose is to increase theutilization of the search data memory 662. Most of the hash pointermemory 660 will be empty but that is acceptable, since it is used toreduce the collision probability in the search data memory 662. With aproper memory depth ratio between the hash pointer memory 660 and thesearch data memory 662, the amount of the search data memory 662required can be reduced.

[0115] As can be seen in FIG. 9a, the comparison section 652 providesthe pointer value to the first logic unit 640 and it is what isultimately used in this embodiment to access the base region of thememory 614. The second logic unit 658 passes the pointer value of asearch to the first logic unit 640 (the mere presence of a value denotesa hit but using a separate signal, as is depicted, provides some speedand design benefits). Thus, if 4-way set-associativity is used the firstlogic unit 640 can provide four hash addresses to the comparison section652 and it will provide up to one pointer value back. The controller 612can then also be signaled, via a hit line 664, that the search result onthe result bus 620 is a valid one.

[0116] With reference briefly again to TABLE 1, it also summarizes thedifference between the prior art hash-based and CAM-based approaches anda simple embodiment of the invention depicted in FIG. 8, and FIGS. 9a-b.The specifications are essentially the same as for the prior artexamples, except that a size of 128×100K is chosen for the CAM unit 624based on an assumption that not more than 10% of the total database sizeneed be devoted to handling hash collisions. As can be seen, the H-CAM610 has the same speed as the prior art CAM-based approach. It hasroughly the same total bus pin-count at the controller 612 as the priorart CAM-based approach (the hit line 664 may require as little as asingle-pin) and it has a substantially lower pin-count than the priorart hash-based approach. This item bears some further comment. In theH-CAM 610 a result bus 620 can be as narrow as 32 bits wide, since itcarries only the associate value. In contrast, the result busses 20, 220have to be 160 bits wide to carry both the stored search value andassociate value.

[0117] In TABLE 1 the H-CAM 610 is shown having roughly the same costand power consumption as the prior art hash-based approach, but this issomewhat misleading. The H-CAM 610 here employs only 2-wayset-associativity. If a higher degree of multi-way set-associativity isused additional cost and power savings can be had, providing the presentinvention with even greater advantage over the hash-based and CAM-basedprior art.

[0118] For an example lets now consider a 4-way set-associative casewherein 128-bit wide search values are used to search a database of onemillion entries. The memory 614 needs to be 1M×32 in size, to handleonly the one million desired entries (100% utilization is possiblebecause using the pointer values are used). Furthermore, since a highpercentage of hash collisions can be handled by the use of multi-wayset-associativity, the CAM unit 624 can be small, say, only 32K×128 insize. It should particularly be noted that increasing the degree ofmulti-way set-associativity in this manner permits the CAM unit 624 tobecome decreasingly small, almost trivially small. This is verybeneficial if actual content associative type memory is used (typicallynecessary where high speed is desired). Such true CAM requires more diearea and consumes more power than most other types of memory, andusually is much more expensive. Reducing the amount of CAM used istherefore desirable.

[0119] Continuing with the example, the hash pointer memory 660 needs tobe 4M×20 and the search data memory 662 needs to be 1M×128. The hashaddresses need to be 22-bits wide, to address the four million locationsin the hash pointer memory 660. The pointer values are 20-bits wide,since they only need to address the entries (associate content) in thememory 614 and to also address the one million entries (stored searchvalues) in the search data memory 662. The total memory required in theexample above is equivalent to 4M×61(1M×32+32K×128+4M×20+1M×128), whichis a marked reduction from the 4M×160 a conventional 4-way setassociative approach would require.

[0120] There are many different ways to implement the comparison section652, and the architecture of these (and the hash algorithm) play animportant role in overall efficiency. If designed correctly, thisapproach is able to reduce the total amount of memory (CAM and other)required. As can be seen in TABLE 1, this can produce a substantial costsavings. Basically, two things can be improved. The first is thehandling of hash collisions by using a multi-way set associative hash,and the other is to reduce the depth of the search data storage 654,because the search values are usually very wide.

[0121] A H-RAM and a Search Engine Employing It:

[0122]FIG. 10 is a block diagram depicting a search engine 700 accordingto another preferred embodiment of the present invention. Theparticularly novel aspect here is a H-RAM 710 which also employs avariation of the hash pointer (FIG. 3) to perform internal comparisonsfor detecting hash collisions. The H-RAM 710 works with a controller 712and a memory 714. As was the case for the H-CAM 610 of FIG. 8, these maybe substantially conventional. The controller 712 here also does notneed to receive any stored search values back for performing comparisons(reducing its pin-count and footprint), and the memory 714 here alsodoes not need to store the search values (reducing its size).

[0123] As shown in FIG. 10, the architecture of the H-RAM 710 is notablein that it does not employ a CAM. The underlying rationale here is thatif a sufficiently high degree of multi-way set associativity isprovided, CAM is not needed to address hash collisions.

[0124] The H-RAM 710 includes a hash unit 722, a first logic unit 740,and a comparison section 752. The comparison section 752 includes asearch data storage 754, a comparator 756, and a second logic unit 758.

[0125] With reference now also to FIGS. 11a-b, FIG. 11a is a blockdiagram depicting one possible internal architecture for the first logicunit 740 and FIG. 11b is a block diagram depicting one possible internalarchitecture for the search data storage 754. Turning first to FIG. 11a,the first logic unit 740 here is simpler than the first logic unit 640and in FIG. 9a. It converts the (n-bit) hash output into (m-bit) hashaddresses, and it performs any desired translation of the (n-bit)indirect hash pointer into the address value for use with the memory714.

[0126] As can be seen by comparing FIG. 11b with FIG. 9b, the searchdata storage 754 and the search data storage 654, and for that matterthe comparison section 752 and the comparison section 652, may beessentially the same.

[0127] A Multi-Level H-CAM with Routing Logics, and a Search EngineEmploying It:

[0128]FIG. 12 is a block diagram depicting a search engine 800 accordingto another preferred embodiment of the present invention, an embodimentincorporating many of the principals so far discussed into a H-CAM 810.A controller 812 and memory 814 (potentially the same as those used inthe embodiments of FIGS. 8 and 10) are present again and key points tonote are in the architecture of the H-CAM 810.

[0129] The H-CAM 810 here includes hash blocks 862, a CAM block 864, acomparison section 866, and a main logic unit 868. The hash blocks 862each include a paired input logic sub-unit 870 and hash unit 872. TheCAM block 864 includes an input logic sub-unit 874, a number of CAMunits 876 (typically equal in number to the hash blocks 862), and anoutput logic sub-unit 878. The comparison section 866 includes a searchdata storage 880, a comparator 882, and an output logic sub-unit 884.

[0130] The input logic sub-units 870 of the hash blocks 862 route dataoff of a common input path 886 into the individual hash block 862 oronward to the CAM block 864, or route the output data from a prior hashblock 862 in similar manner. The input logic sub-unit 874 of the CAMblock 864 routes data into the CAM units 876, and the output logicsub-unit 878 combines and routes data from the CAM units 876. The outputlogic sub-unit 884 of the comparison section 866 combines and routesdata from the comparison section 866. The data received from the lasthash block 862, the output logic sub-unit 878 of the CAM block 864, andthe output logic sub-unit 884 of the comparison section 866 is used bythe main logic unit 868, which outputs information to the comparisonsection 866, to the memory 814, and to the controller 812, via a hitline 888.

[0131] The H-CAM 810 can be user configured to work as a 4-level unit,much in the manner described for the H-CAM 310 in FIG. 5; or it can beconfigured to work as a 2-level unit, much in the manner described forthe H-CAM 410 in FIG. 6; or it can be configured to work as a 1-levelunit, much in the manner described for the H-CAM 210 in FIG. 4. Inparticular, it can be configured to work as a 1-level unit similar tothe H-CAM 610 and which operates on very large data. The hash blocks 862can be configured to each handle part of a wide input on the commoninput path 886, in parallel, or they can be operated in serial fashionas has essentially been described elsewhere herein. The CAM block 864can handle either case, with its input logic sub-unit 874 and its outputlogic sub-unit 878 configurable to use the CAM units 876 as oneeffective large CAM or as smaller amounts of CAM. The comparison section866 and its output logic sub-unit 884 are similarly configurable to workwith the configuration of the other components.

[0132] Cascading in a Search Engine, Shown with H-CAMS:

[0133]FIG. 13 is a block diagram depicting a search engine 900 accordingto another preferred embodiment of the present invention, an embodimentemploying the ability to scale for large needs by cascading multipleH-CAMs 910 to form a bigger overall system. If the internal architectureof the H-CAMs 910 generally resembles that of the H-CAMs 210, 310, 410,and an expansion bus 922 is added, a controller 912, memory 914, searchdata bus 916, address bus 918, and result bus 920 may be used which areessentially similar to those used there with. Alternately, if theinternal architecture of the H-CAMs 910 resembles that of the H-CAMs610, 810, and the expansion bus 922 is added, the controller 912, memory914, result bus 920, and a hit line 924 may be used which areessentially similar to those used there with. The memory 914 mayaccordingly store the search data values and the associate contentvalues or just the associate content values.

[0134] These architectures combines all the benefits of hash algorithmand CAM to provide an efficient and cost effective way to supportsearching large databases. The search engine 900 can support very largedatabase searching without using large amounts of memory to accommodatepossible hash collisions, yet it can achieve the same search performanceas prior art CAM-based approaches without the attendant high cost andpower consumption. Although this approach cannot guarantee a specificcapacity to avoid hash collisions, similar to prior art hash-basedapproaches, with the proper hash algorithm and number of ways ofset-associativity this variation of the invention can nonethelessachieve very high utilization. This coincides well with a key goal ofthe present invention, to increase the degree or number of ways ofset-associativity without increasing the memory speed or the bandwidthrequirement.

[0135] A cascaded approach makes use of the power of distributedprocessing. If each H-CAM supports an n-way-set-associative hash, theentire system would be able to support (n×number of H-CAM)-way-setassociative hash. Multiple H-CAMs, such as the H-CAM 610 shown in FIG.8, can be cascaded together, such as through the expansion bus 922 asshown in FIG. 13. If n=2 and five H-CAMs are cascaded together, thesystem can employ a 10-way-set-associative hash and the hash pointermemory and the search data memory within each H-CAM need to only supporttwo reads per input search value, instead of the ten that would beneeded in a typical prior art 10-way-set-associative hash approach.

[0136] TABLE 3 provides a comparison of two different implementations ofa one million entry 8-way-set-assoicative hash-based system. One uses atypical prior art hash-based approach, while the other uses the H-CAMwith the indirect hash pointer and a cascading mechanism. If each H-CAMsupports a 2-way-set-associative hash, four are needed to implementthis. Each H-CAM will have 256K entries in the search data memory and512K pointers in the hash pointer memory. Further assuming each searchdata entry is 128-bits wide, it can be seen that the inventive approachuses only about one-sixth of the memory and requires only one-fourth ofthe memory bandwidth.

[0137] Cascading in a Search Engine, Shown with H-RAMS:

[0138]FIG. 14 is a block diagram depicting a search engine 1000according to another preferred embodiment of the present invention, anembodiment employing the ability to scale for large needs by cascadingmultiple H-RAMs 1010. In structure the search engine 1000 here muchresembles the search engine 900 of FIG. 13, a controller 1012, memory1014, search data bus 1016, address bus 1018, and result bus 1020 areprovided, and an expansion bus 1022 is used to interconnect the H-RAMs1010.

[0139] Cascading in a Search Engine, Shown with CAMS, H-CAMS and H-RAMSin Combination:

[0140]FIG. 15 is a block diagram depicting a search engine 1100according to another preferred embodiment of the present invention, anembodiment employing the ability to scale for large needs by cascadingmultiple of CAMs 1110 a, H-CAMs 1110 b, and H-RAMs 1110 c, with acontroller 1112, memory 1114, search data bus 1116, address bus 1118,and result bus 1120 and all interconnected by an expansion bus 1122. Thesearch engine 1100 thus is particularly powerful and configurable tovarious applications, including searching very large and highlyspecialized databases.

SUMMARY

[0141] A lot has been presented herein. The prior art hash approach wasdiscussed, including multi-way set-associativity (see e.g., FIG. 1(background art)), and the prior art CAM approach was also discussed(see e.g., FIG. 2 (background art)). A novel hash pointer approach wasthen discussed (see e.g., FIG. 3), including how it provides thebenefits of multi-way set-associativity without the poor memoryutilization that is characteristic of the prior art.

[0142] A novel H-CAM approach was next discussed, with coverage of itincluding how it provides many of the benefits of the respective hashand CAM approaches, but without many of the respective disadvantages.FIG. 4 depicted a single level H-CAM variation, and FIG. 5 depicted amulti level H-CAM variation. Both of these examples use 1-wayset-associativity, for simplicity, but using multi-way set-associativityis a straight forward extension. FIG. 6 covered programming, which isessentially also straight forward and possible with generallyconventional techniques, and FIG. 6 and the flow chart of FIG. 7 wereused in a detailed example.

[0143] A novel “local” comparison approach for moving the task ofcomparison into the H-CAM was discussed (see e.g., FIGS. 8 and 9a-b),employing a variation of the hash pointer approach (FIG. 3). As is thecase with just the hash pointer approach, this local comparison approachprovides particular benefit when used with multi-way set-associativity.

[0144] A novel H-RAM approach was then discussed, one which uses avariation of the local comparison approach (see e.g., FIGS. 10 and11a-b). Enhancing the multi level H-CAM by using internal routing logicswas also discussed, with optional local comparison included (see e.g.,FIG. 12). Finally, cascading multiple H-CAMs, cascading multiple H-RAMs,and cascading multiple CAMs, H-CAMs, and H-RAMs together in combinationwere shown (FIGS. 13-15).

[0145] Accordingly, while various embodiments have been described above,it should be understood that they have been presented by way of exampleonly, and not limitation. Thus, the breadth and scope of the inventionshould not be limited by any of the above described exemplaryembodiments, but should be defined only in accordance with the followingclaims and their equivalents.

INDUSTRIAL APPLICABILITY

[0146] The present search engines 100, 200, 300, 400, 600, 700, 800,900, 1000, 1100, and the individual H-CAMs 210, 310, 410, 610, and 810and the individual H-RAM 710 are well suited for application in thesearching of databases of associate content. The search engines, H-CAMs,and H-RAM can search large databases, particularly when variations suchas the configurable embodiment depicted in FIG. 12 or the cascade ableembodiments depicted in FIGS. 13-1 5 are used.

[0147] The invention can substantially reduce the memory needed fordatabase storage. The embodiment depicted in FIG. 3 shows how theinvention permits memory size to not be based on the degree of multi-wayset-associativity used. The embodiments depicted in FIGS. 4-6 show howdatabase memory may also be reduced by not storing instances of thesearch values in a highest level conflicts region in the main memory,and the embodiments depicted in FIGS. 8-12 show how database memory maybe reduced to store only associate content, and then with a very highdegree of utilization.

[0148] The invention can also substantially reduce the time needed forconducting database searches. While the embodiments depicted in FIGS.3-6 show that the invention can at least equal the search speed ofhash-based prior art approaches, the more sophisticated embodimentsdepicted in FIGS. 8-11 show how the invention can better the searchspeed of hash-based prior art approaches and approach the speed ofCAM-based prior art approaches.

[0149] The invention can also substantially reduce the overall searchengine and database storage system cost. This is achieved directly byincreasing memory utilization, and thus reducing the need for memory.Cost reduction is also further achieved indirectly, by reducing buswidths, pin counts, circuit foot print, power consumption (anddissipating heat), etc.

[0150] For the above, and other, reasons, it is expected that thepresent invention will have widespread industrial applicability.Therefore, it is expected that the commercial utility of the presentinvention will be extensive and long lasting.

1. A search engine, comprising: a controller including a hash functionable to receive an input search value and to create there from at leastone hash address which is smaller in size than said input search value;a hash pointer unit able to store a plurality of pointer values, whereinrespective said pointer values are addressed based on said hashaddresses; a memory suitable for storing a database of search results,wherein respective said search results are addressed based on saidpointer values; an address bus operationally connecting said controllerto said hash pointer unit and able to communicate said hash addressesfrom said controller to said hash pointer unit; a pointer busoperationally connecting said hash pointer unit to said memory and ableto communicate said pointer value from said hash pointer unit to saidmemory; and a result bus operationally connecting said memory to saidcontroller and able to communicate said search result from said memoryto said controller, thereby permitting the search engine to function ina multi-way set-associative manner wherein the size of said memory isnot a function of the degree of multi-way set-associativity.
 2. Thesearch engine of claim 1, wherein said pointer values are equal orsmaller in size than said hash address.
 3. The search engine of claim 1,wherein said search results each include a stored search value and anassociate value, thereby permitting said controller to compare instancesof said input search value with said stored search value to determinewhether a hash collision has occurred and when said associate value istrustworthy.
 4. The search engine of claim 3, wherein said hash functiongenerates a hash value and said controller creates said hash addressbased on said hash value and an offset value.
 5. A search engine,comprising: controller means for controlling the search engine, saidcontroller means including hash means for receiving an input searchvalue and creating there from at least one hash address which is smallerin size than said input search value; hash pointerizing means forstoring a plurality of pointer values, wherein respective said pointervalues are addressed based on said hash addresses; memory means forstoring a database of search results, wherein respective said searchresults are addressed based on said pointer values; address bus meansfor operationally connecting said controller to said hash pointer unitand for communicating said hash addresses from said controller to saidhash pointer unit; pointer bus means for operationally connecting saidhash pointer unit to said memory and for communicating said pointervalue from said hash pointer unit to said memory; and result bus meansfor operationally connecting said memory to said controller and forcommunicating said search result from said memory to said controller,thereby permitting the search engine to function in a multi-wayset-associative manner wherein the size of said memory is not a functionof the degree of multi-way set-associativity.
 6. The search engine ofclaim 5, wherein said pointer values are equal or smaller in size thansaid hash address.
 7. The search engine of claim 5, wherein said searchresults each include a stored search value and an associate value,thereby permitting said controller means to compare instances of saidinput search value with said stored search value to determine whether ahash collision has occurred and when said associate value istrustworthy.
 8. The search engine of claim 7, wherein said hash means isfurther for generating a hash value and said controller means is furtherfor creating said hash address based on said hash value and an offsetvalue.
 9. A method for searching a database of search results, whereinthe search results each include a stored search value, the methodcomprising the steps of: (a) generating a hash value from an inputsearch value, wherein said hash value is smaller in size than said inputsearch value; (b) creating a plurality of hash addresses based on saidhash value and respective offset values; (c) retrieving pointer valuesfrom a pre-stored plurality of said pointer values based on said hashaddresses; (d) retrieving instances of the search results from thedatabase based on said pointer values; and (e) comparing said inputsearch value and said stored search values in said instances of thesearch results retrieved in said step (d) to determine whether arespective hash collision has occurred, wherein a presumably usable saidinstance of the search results is one wherein a hash collision has notoccurred, thereby searching the database in a multi-way set-associativemanner wherein the size of the database is not a function of the degreeof multi-way set-associativity.
 10. The method of claim 9, wherein saidpointer values are equal or smaller in size than said hash address. 11.The method of claim 9, wherein the search results each include a storedsearch value and an associate value, and the method further comprising:(f) selecting a usable said associate value, if any, as being that fromsaid usable said instance of the search results.